package com.itdianzi.controller.converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyConverter implements org.springframework.core.convert.converter.Converter<String,Date> {
    @Override
    public Date convert(String source) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date date = null;
        try {
            date = (Date) simpleDateFormat.parse(source);
        } catch (ParseException e) {
            System.out.println("日期转换失败");
        }
        return date;
    }
}
